package cn.edu.lingnan.servlet.position;

import cn.edu.lingnan.pojo.Club;
import cn.edu.lingnan.pojo.Position;
import cn.edu.lingnan.service.ClubService;
import cn.edu.lingnan.service.ClubServiceMysqlImpl;
import cn.edu.lingnan.service.PositionService;
import cn.edu.lingnan.service.PositionServiceMysqlImpl;
import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.servlet.http.HttpSession;

import java.io.IOException;
import java.util.List;

@WebServlet("/position/queryAllPost")
public class QueryPositionAllServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        PositionService service=new PositionServiceMysqlImpl();
        List<Position>list=service.findPositionAll();
        HttpSession session= req.getSession();
        session.setAttribute("PostList",list);
//        System.out.println(666);
        System.out.println(list);
        resp.sendRedirect(req.getContextPath()+"/admin/position/allPost.jsp");
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doGet(req,resp);
    }
}
